package org.example.book.controller;


import org.example.book.unuse.Dbtype;
import org.example.book.unuse.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/yml")
@RestController
public class ReadymlController {
    @Value("${mykey}")
    private String key;
    @Value("${server.port}")
    private Integer port;
    @Value("${mykey.key1}")
    private String key1;

    @Value("${String.String1}")
    private String string1;
    @Value("${String.String2}")
    private String string2;
    @Value("${String.String3}")
    private String string3;

    @Autowired
    private Student student;

    @Autowired
    private Dbtype dbtype;


    @RequestMapping("/readyml")
    public String readyml(){
        return "从yml中读取配置文件"+key;
    }
    @RequestMapping("/readyml2")
    public String readyml2(){
        return "从yml中读取配置文件"+port;
    }
    @RequestMapping("/readyml3")
    public String readyml3(){
        return "从yml中读取配置文件"+key1;
    }

    @RequestMapping("/readyml4")
    public String readyml4(){
        System.out.println(string1);
        System.out.println(string2);
        System.out.println(string3);//换行了
        return "从yml中读取配置文件";
    }
    @RequestMapping("/readStudent")
    public String readStudent(){
        return "从yml中读取配置文件Student:"+student;
    }
    @RequestMapping("/readDbtype")
    public String readDbtype(){
        return "从yml中读取配置文件Dbtype:"+dbtype;
    }

}
